﻿using System;
using System.Text;
using System.Drawing;
using System.Buffers;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;

public static partial class glDRIVE
{
    /*
    函数 gl.tmul
    实矩阵相乘
    参数 a: 矩阵A[ma][na]
    参数 ma: 
    参数 na: 
    参数 b: 矩阵B[mb][nb]
    参数 mb: 
    参数 nb: 
    参数 c: 乘积矩阵C[ma][nb] = A[ma][na] * B[mb][nb]
    */

    public static string drive_tmul()
    {
        int i, j;
        double[,] a = new double[4, 5] {
            {1.0,3.0,-2.0,0.0,4.0},
            {-2.0,-1.0,5.0,-7.0,2.0},
            {0.0,8.0,4.0,1.0,-5.0},
            {3.0,-3.0,2.0,-4.0,1.0}
        };
        double[,] b = new double[5, 3] {
            {4.0,5.0,-1.0},
            {2.0,-2.0,6.0},
            {7.0,8.0,1.0},
            {0.0,3.0,-5.0},
            {9.0,8.0,-6.0}
        };
        double[,] c = new double[4, 3];

        string rs = "";
        rs += gl.html_table("Mat A:", a);
        rs += gl.html_table("Mat B:", b);

        gl.tmul(a, 4, 5, b, 5, 3, c);
        rs += gl.html_table("Mat C=AxB:", c);
        return rs;
    }
}
